package linkwechat.controller.system;

import linkwechat.pojo.LinkRole;
import linkwechat.pojo.ReturnData;
import linkwechat.service.systemservice.RoleGlService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("LinkRoleGl")
public class LinkRoleManageMent {

    @Autowired
    RoleGlService roleGlService;

    //查询
    @RequestMapping("/getAllrole")
    @ResponseBody
    public ReturnData getAllrole(LinkRole role){
        return roleGlService.getRole(role);
    }


    //树形节点显示
    @RequestMapping("/selectMenu")
    @ResponseBody
    public ReturnData SelectMenu(){
        return roleGlService.SelectMenu();
    }


    //角色树形节点显示
    @RequestMapping("/selectMenuRole")
    @ResponseBody
    public ReturnData SelectMenuRole(Long id){
        return roleGlService.SelectMenuRole(id);
    }


    //新增
    @RequestMapping("/AddRole")
    @ResponseBody
    public ReturnData AddRole(LinkRole role){
        ReturnData returnData = null;
        if (role.getRoleId()==null){
           returnData =  roleGlService.AddRole(role);
        }
        returnData = roleGlService.UpdRole(role);
        return returnData;
    }

    @RequestMapping("/DeleteRole")
    @ResponseBody
    public ReturnData DeleteRole(Long[] ids){
        return roleGlService.DeleteRole(ids);
    }

}
    